package com.guanyong.dao;


import com.guanyong.model.KeywordModel;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * Created by mxk on 2017/5/26.
 * 点击日志
 */
public interface IKeyWordDaoMapper {


    int insert(KeywordModel record);


    @Select("SELECT * FROM t_ad_keyword  where f_id=#{fId} limit 1")
    @ResultMap("KeyWordResultMap")
    KeywordModel selectByPrimaryKey(Integer fId);

    @Select("SELECT * FROM t_ad_keyword  where f_keywordmd5=#{fkeywordmd5} limit 1")
    @ResultMap("KeyWordResultMap")
    KeywordModel selectByKeywrod(String  fkeywordmd5);


    @Select("SELECT * FROM t_ad_keyword order by f_searchct desc limit #{count}")
    @ResultMap("KeyWordResultMap")
    List<KeywordModel> SelectHotSearch(Integer count);

    @Update(" update t_ad_keyword set f_searchct=f_searchct+1  where f_id=#{fId} ")
    Integer UpdateSearchCt(Integer fId);

    @Select("SELECT * FROM t_ad_keyword  where f_keywordmd5=#{fkeywordmd5} and f_userid=#{userid} limit 1")
    @ResultMap("KeyWordResultMap")
    KeywordModel selectByKeywrod1_0(@Param("fkeywordmd5")String fkeywordmd5,  @Param("userid")String userid);

    @Update(" update t_ad_keyword set f_searchct=f_searchct+1  where f_id=#{fId} and  f_userid=#{userid}")
    Integer UpdateSearchCt1_0(@Param("fId")Integer fId, @Param("userid")String userid);

    @Select("SELECT * FROM t_ad_keyword where f_userid=#{userid}" +
            " order by f_searchct desc limit #{count}")
    @ResultMap("KeyWordResultMap")
    List<KeywordModel> SelectHotSearch1_0( @Param("count")Integer count,  @Param("userid")String userid);
}
